#include "ClientSocket.h"

bool ClientSocket::ClientOpen(const char* server, int port)
{
	m_Port=port;
	m_Open=true;
	SDLNet_ResolveHost(&m_Ip,server,port);
	if(m_Ip.host == INADDR_NONE)
	{
		return false;
	}

	m_TcpSock = SDLNet_TCP_Open(&m_Ip);
	if(!m_TcpSock)
	{
		return false;
	}

	m_SockSet=SDLNet_AllocSocketSet(1);
	if(m_TcpSock)
	{
		SDLNet_TCP_AddSocket(m_SockSet,m_TcpSock);
	}

	return true;

}